<?php
/**
* TrackStateClass 
*
* This class is designed to work with current orders -
*
* @author Victor Magarlamov <victor.magarlamov@gmail.com>
* @version 1.0
* @package presstrack
*/
 
class TrackStateClass 
{
	public $_explicitType = "presstrack.TrackStateClass";
	
	public $iState;
	public $mLabel;
	public $mNote;
	public $mColor;
	
	function __construct() 
	{
		$this->iState = 20;
		$this->mColor = "#dddddd";
    }

	function setFrom($task)
	{
		if ($task->state < $this->iState)
		{
			$this->iState = $task->state;
			switch ($this->iState){
				case 1: 
					$this->mColor = "#FFFFFF"; 
				break;
				
				case 2: 
					$this->mColor = "#FAEC0C"; 
				break;
				
				case 3: 
					$this->mColor = "#2e93fb"; 
				break;
				
				case 4: 
					$this->mColor = "#05fb16"; 
				break;
				
				case 5: 
					$this->mColor = "#fd0410"; 
				break;
			}
		}
		
		if(mb_strlen($task->state_note, "utf-8") > 3) 
		{
			$this->mNote = $task->state_note;
			$this->mLabel = "!!!";
		}
	}
}
?>